import service from "../../utils/request.ts";

/**
 * 获取部门树
 * @returns {*}
 */
export const getDeptTreeApi = (deptName) => {
    return service({
        url: '/dept/tree',
        method: 'get',
        params:{deptName},
        data:null
    })
}



/**
 * 获取父级部门
 * @returns {*}
 */
export const getParentDeptList = () => {
    return service({
        url: '/dept/parent',
        method: 'get',
        data:null
    })
}
/**
 * 添加部门信息
 * @returns {*}
 */
export const addDeptInfos = (data) => {
    return service({
        url: '/dept/add',
        method: 'post',
        data:data
    })
}
/**
 * 修改部门信息
 * @returns {*}
 */
export const updateDeptInfos = (data) => {
    return service({
        url: '/dept/update',
        method: 'put',
        data:data
    })
}

/**
 * 删除部门信息
 * @returns {*}
 */
export const removeDept = (id) => {
    return service({
        url: `/dept/${id}`,
        method: 'delete',
        data:null
    })
}

/**
 * 根据id获取部门信息
 * @returns {*}
 */
export const getDeptInfoById = (id) => {
    return service({
        url: `/dept/${id}`,
        method: 'get',
        data:null
    })
}


/**
 * 导入部门信息
 * @param file
 */
export const importDept = (file)=> {
    return service({
        url: `/dept/import`,
        method: 'Post',
        data: file
    })
}
/**
 * 获取用户部门列表
 */
export const getDeptList= ()=> {
    return service({
        url: "/dept/list",
        method: "get",
        data:null
    })
}